package com.catsic.core.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.catsic.base.tree.TreeImpl;

/**
 * ClassName: Department
 * Description: 部门实体
 * date: 2014年2月27日 下午4:54:01
 * author: huyulei
 */
 
@Entity
@Table(name="S_DEPART")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Depart extends TreeImpl<Depart> implements Serializable{
	
	/**
	 * serialVersionUID:VersionUID
	 */
	private static final long serialVersionUID = 2011838607320592101L;
	
	/**
	 * organ:所属机构
	 */
	@ManyToOne(fetch = FetchType.LAZY,optional = false)
	@JoinColumn(name="OID",referencedColumnName = "ID")
	private Organ organ;
	
	/**
	 * users:用户
	 */
	@OneToMany(cascade=CascadeType.REMOVE,fetch = FetchType.LAZY,mappedBy="depart") 
    private List<User> users;

	public Organ getOrgan() {
		return organ;
	}

	public void setOrgan(Organ organ) {
		this.organ = organ;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	} 
}
